package com.example.myapplication.customizeView;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

import com.example.myapplication.R;
import com.example.myapplication.customizeView.loginpage.LoginPageView;

public class LoginActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_login);
        LoginPageView loginPageView = this.findViewById(R.id.login_page_view);
        loginPageView.setOnLoginPageActionListener(new LoginPageView.OnLoginPageActionListener() {
            @Override
            public void onGetVerifyCodeClick(String phoneNum) {
                 //获取验证码
                Toast.makeText(LoginActivity.this,"验证码已发送",Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onOpenAgreementClick() {
                //协议

            }

            @Override
            public void onConfirmClick(String verifyCode, String phoneNum) {
                //登录
              App.getHandler().postDelayed(new Runnable() {
                  @Override
                  public void run() {
                      //第一步，给一个Toast提示
                      Toast.makeText(LoginActivity.this,"验证码错误",Toast.LENGTH_SHORT).show();
                      loginPageView.onVerifyCodeError();
                  }
              },4000);

            }
        });
    }
}